package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDate;
import java.util.List;

/**
 * 订单实体类
 */
@TableName("t_order")
public class OrderBean {
    /**订单编号**/
    @TableId(value = "pk_orderId",type = IdType.AUTO)
    private Integer id;
    @TableField("fk_userId")
    /**用户编号**/
    private Integer userId;
    @TableField(exist = false)
    private UserBean user;
    /**收货人**/
    @TableField("o_receiver")
    private String receiver;
    /**收货地址**/
    @TableField("o_address")
    private String address;
    /**收货人电话**/
    @TableField("o_phone")
    private String phone;
    /**订单生产日期**/
    @TableField("o_date")
    private LocalDate date=LocalDate.now();
    /**总价**/
    @TableField("o_total")
    private Integer total;
    /**状态**/
    @TableField("o_status")
    private String status="未发货";
    @TableField(exist = false)
    /**订单明细集合**/
    private List<DetailBean> detailList;

    public OrderBean() {
    }

    public OrderBean(Integer userId, String receiver, String address, String phone) {
        this.userId = userId;
        this.receiver = receiver;
        this.address = address;
        this.phone = phone;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getReceiver() {
        return receiver;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public UserBean getUser() {
        return user;
    }

    public void setUser(UserBean user) {
        this.user = user;
    }

    public LocalDate getDate() {
        return date;
    }

    public void setDate(LocalDate date) {
        this.date = date;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<DetailBean> getDetailList() {
        return detailList;
    }

    public void setDetailList(List<DetailBean> detailList) {
        this.detailList = detailList;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    @Override
    public String toString() {
        return "OrderBean{" +
                "id=" + id +
                ", userId=" + userId +
                ", user=" + user +
                ", receiver='" + receiver + '\'' +
                ", address='" + address + '\'' +
                ", phone='" + phone + '\'' +
                ", date=" + date +
                ", total=" + total +
                ", status='" + status + '\'' +
                ", detailList=" + detailList +
                "}\n";
    }
}
